package com.example.videoplayer.repository;

import com.example.videoplayer.model.User;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import reactor.core.publisher.Mono;

public interface UserRepository extends ReactiveCrudRepository<User, Long> {
    
    Mono<User> findByUsername(String username);

    @Query("SELECT * FROM users WHERE username = :username AND enabled = true")
    Mono<User> findActiveUserByUsername(String username);

    @Query("UPDATE users SET password = :password WHERE id = :id")
    Mono<Void> updatePassword(Long id, String password);
} 